import request from '@/utils/request'

export default {
    //1.添加课程信息
    addCourseInfo(courseInfo) {
        return request({
            url: '/eduservice/course/addCourseInfo',
            method: 'post',
            data: courseInfo
        })
    },

    //查询所有讲师
    getListTeacher() {
        return request({
            url: '/eduservice/teacher/findAll',
            method: 'get'
        })
    },

    //根据课程id查询课程基本信息
    getCourseInfoId(id) {
        return request({
            url: `/eduservice/course/getCourseInfo/${id}`,
            method: 'get'
        })
    },

    //修改课程信息
    updateCourseInfo(courseInfo) {
        return request({
            url: `/eduservice/course/updateCourseInfo`,
            method: 'post',
            data: courseInfo
        })
    },
    
    //修改课程信息
    getPublishCourseInfo(id) {
        return request({
            url: `/eduservice/course/getPublishCourseInfo/${id}`,
            method: 'get',
        })
    },

    publihCourse(id) {
        return request({
            url: `/eduservice/course/publishCourse/${id}`,
            method: 'post',
        })
    },

    revokeCourse(id) {
        return request({
            url: `/eduservice/course/revokeCourse/${id}`,
            method: 'post',
        })
    },

    //TODO 课程列表
    //课程最终发布
    getListCourse(page, limit) {
        return request({
            url: `/eduservice/course/pageCourse/${page}/${limit}`,
            method: 'get'
          })
    },

    //课程删除
    deleteCourse(id) {
        return request({
            url: `/eduservice/course/${id}`,
            method: 'delete'
        })
    }
}